# The guess API is already defined for you.
# @param num, your guess
# @return -1 if my number is lower, 1 if my number is higher, otherwise return 0
def guess(num):
    if num > 6:
        return 1
    elif num < 6:
        return -1
    else:
        return 0

class Solution(object):
    def guessNumber(self, n):
        """
        :type n: int
        :rtype: int
        """
        begin = 1
        end = n
        while begin < end:
            middle = (begin+end)//2
            ret = guess(middle)
            if ret<0:
                end=middle-1
            elif ret>0:
                begin=middle+1
            else:
                return middle
        return begin

print(Solution().guessNumber(10))